package com.practice.system.service.impl;

import com.practice.system.mapper.EnergyDataMapper;
import com.practice.system.pojo.EnergyData;
import com.practice.system.service.EnergyDataService;
import com.practice.utils.PageUtils;
import com.practice.utils.Query;
import com.practice.utils.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;


import java.util.List;
import java.util.Map;

@Service
public class EnergyDataServiceImpl implements EnergyDataService {
    @Autowired
    EnergyDataMapper energyDataMapper;
    @Override
    public R queryPage(Map<String, Object> params) {
        new Query().setStartPage(params);
        List<EnergyData> list = energyDataMapper.findEnergyDataByPage(params);
        long count = energyDataMapper.getDeviceCount(params);
        PageUtils<EnergyData> page = new PageUtils<>(list, count);
        return R.ok().put("page",page);
    }
}
